<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>床前明月光</div>
    <p>
        疑是地上霜
        <a href="">举头望明月</a>
    </p>
    <script>
        //获取元素
        var div = document.querySelector('div');
        //通过innerText修改元素内容
        div.innerText = '低头思故乡';
        //获取元素
        var p = document.querySelector('p');
        //通过innerHTML打印元素内容
        console.log(p.innerHTML);
        //通过innerText打印元素内容
        console.log(p.innerText);
        //通过textContent打印元素内容
        console.log(p.textContent);
    </script>
</body>
</html>